<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>JD自动挂机</title>
    <style>
        .form {
            width: 300px;
            height: 300px;
            margin: 0 auto;
        }
    </style>

</head>

<body>
    <SCRIPT language=javascript>
        function click() {
            if (event.button == 2) {
                alert('小机灵鬼不许偷看！');
            }
        }
        document.onmousedown = click
    </SCRIPT>
    <div id="content" style="margin: 0px; padding: 0px; clear: both; color: rgb(102, 102, 102); font-family: Arial,Verdana,宋体; font-size: 12px; font-style: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">

        <div class="login-wrap" style="margin: 0px 0px 20px; padding: 0px; position: relative; height: 475px; z-index: 5;">
            <div class="form">
                <div class="login-form" style="margin: 0px; padding: 0px; background: rgb(255, 255, 255) none repeat scroll 0%; position: relative; z-index: 4; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; overflow: visible; width: 346px; float: right; top: 10px;">
                    <div class="tips-wrapper" style="margin: 0px; padding: 10px 0px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; width: 346px; text-align: center;">
                        <div class="tips-inner" style="margin: 0px; padding: 0px;">
                            <div class="cont-wrapper" style="margin: 0px; padding: 0px; width: 350px;">
                                <p style="margin: 0px; padding: 0px; vertical-align: middle; color: rgb(112, 128, 105); font-size: 18px;"><img src="https://ghproxy.com/https://github.com/U188/JDC/blob/master/logo.png" height="35" width="98">欢迎登陆</p>
                            </div>
                        </div>
                    </div>
                    <div class="login-tab login-tab-l" style="border-bottom: 1px solid rgb(244, 244, 244); margin: 0px; padding: 0px; background: rgb(255, 255, 255) none repeat scroll 0%; height: 54px; font-size: 18px; font-family: &quot;microsoft yahei&quot;; text-align: center; position: absolute; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; display: block; width: 173px;"><a href="javascript:void(0)" clstag="pageclick|keycount|login_pc_201804112|9" class="checked" style="border-right: 1px solid rgb(244, 244, 244); margin: 0px; padding: 0px; color: rgb(102, 102, 102); text-decoration: none; width: 171.266px; height: 18px; position: absolute; left: 0px; top: 18px; font-weight: 700;">扫
码登录</a></div>
                    <div class="login-tab login-tab-r" style="border-bottom: 1px solid rgb(244, 244, 244); margin: 0px; padding: 0px; background: rgb(255, 255, 255) none repeat scroll 0%; height: 54px; font-size: 18px; font-family: &quot;microsoft yahei&quot;; text-align: center; position: absolute; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; display: block; width: 173px; right: 0px;"><a id="jumpapp" href="#" clstag="pageclick|keycount|login_pc_201804112|10" style="border-right: 1px solid rgb(244, 244, 244); margin: 0px; padding: 0px; color: rgb(228, 57, 60); text-decoration: none; width: 171.266px; height: 18px; position: absolute; left: 0px; top: 18px;">APP登录</a></div>
                    <div class="qrcode-login" style="margin: 0px; padding: 20px 18px 20px 20px; display: block; visibility: visible; width: 306px; text-align: center;">
                        <div class="mc" style="margin: 0px; padding: 0px; overflow: visible;">
                            <p align="center"><a style="  text-decoration:none;font-size: 20px;font-family: 微软雅黑;">&nbsp;</a></p><br><br><br>
                            <div><img id="qrcode" height="170em" class="middle" src="./ok.svg" /></div>
                            <div class="qrcode-panel" style="margin: 18px auto 14px; padding: 0px; width: 257px; text-align: center;">
                                <ul style="margin: 0px; padding: 0px; list-style-type: none; list-style-image: none; list-style-position: outside; display: block;">
                                    <li class="fore1" style="border: 0px none ; margin: 0px 5px 0px 0px; padding: 0px 0px 0px 5px;"><span style="margin: 0px; padding: 0px;">打开</span><span>&nbsp;</span><a href="javascript:void(0)" style="margin: 0px 0px 0px -3px; padding: 0px; color: rgb(51, 51, 51); text-decoration: none;"><span
 class="red"
 style="margin: 0px; padding: 0px; color: rgb(228, 57, 60);">手
机京东</span></a></li>
                                    <span>&nbsp;</span>
                                    <li style="margin: 0px 5px 0px 0px; padding: 0px 0px 0px 5px;">扫描 二维码
                                    </li>
                                </ul>
                            </div>
                            <div class="coagent qr-coagent" id="qrCoagent" style="border: medium none ; margin: 0px 0px 0px 15px; padding: 0px; line-height: 25px; height: auto; background-color: rgb(255, 255, 255); font-family: &quot;microsoft yahei&quot;; color: rgb(153, 153, 153);">
                                <ul style="margin: 0px; padding: 0px; list-style-type: none; list-style-image: none; list-style-position: outside; display: block;">
                                    <li style="margin: 0px 18px 0px 0px; padding: 0px; float: left; text-align: left; position: relative;"><em style="margin: 0px; padding: 0px 0px 0px 32px; font-style: normal;">免
输入</em></li>
                                    <li style="margin: 0px 18px 0px 0px; padding: 0px; float: left; text-align: left; position: relative;"><em style="margin: 0px; padding: 0px 0px 0px 32px; font-style: normal;">更
快&nbsp;</em></li>
                                    <li style="margin: 0px 18px 0px 0px; padding: 0px; float: left; text-align: left; position: relative;"><em style="margin: 0px; padding: 0px 0px 0px 32px; font-style: normal;">更
安全</em></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="coagent" id="kbCoagent" style="border-top: 1px solid rgb(244, 244, 244); margin: 0px; padding: 0px 20px; line-height: 50px; height: auto; background-color: rgb(252, 252, 252);">
                        <ul style="margin: 0px; padding: 0px; list-style-type: none; list-style-image: none; list-style-position: outside; display: block;">
                            <li style="margin: 0px; padding: 0px; float: left;">
                                <a href="javascript:void(0)" onclick="window.location.href='https://ghproxy.com/https://github.com/U188/JDC/blob/master/qq.jpg'" clstag="pageclick|keycount|login_pc_201804112|3" class="pdl" style="margin: 0px; padding: 0px 0px 0px 24px; color: rgb(102, 102, 102); text-decoration: none; position: relative;"><span style="margin: 0px; padding: 0px;">QQ通知</span></a><span>&nbsp;</span><span class="line" style="margin: 0px; padding: 0px 10px; color: rgb(204, 204, 204);">|</span></li>
                            <li style="margin: 0px; padding: 0px; float: left;">
                                <a href="javascript:void(0)" onclick="window.location.href='https://ghproxy.com/https://github.com/U188/JDC/blob/master/showqrcode.jpg'" clstag="pageclick|keycount|login_pc_201804112|4" class="pdl" style="margin: 0px; padding: 0px 0px 0px 1px; color: rgb(102, 102, 102); text-decoration: none; position: relative;"><span style="margin: 0px; padding: 0px;">微信通知</span></a>
                            </li>
                            <li class="extra-r" style="margin: 0px; padding: 0px; float: right;">
                                <div style="margin: 0px; padding: 0px;">
                                    <div class="regist-link" style="margin: 0px; padding: 0px; color: rgb(182, 29, 29); font-size: 14px;"><a href="https://ghproxy.com/https://github.com/U188/JDC/blob/master/sm.jpg" clstag="pageclick|keycount|login_pc_201804112|5" target="_blank" style="margin: 0px; padding: 0px; color: rgb(182, 29, 29); text-decoration: none;">使用说明</a></div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>

            <body style="background-image: url(https://ghproxy.com/https://github.com/U188/JDC/blob/master/bj.jpg);">
        </div>
    </div>
    </body>
    <script>
        var timer;
        var qrcode = document.getElementById("qrcode")
        var loginUrl = ""
        var success = "https://ghproxy.com/https://raw.githubusercontent.com/764763903a/xdd-plus/main/static/ok.svg";
        var jumpapp = document.getElementById('jumpapp')
        var hd = document.getElementById("hd")

        function showQrcode() {
            var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    data = JSON.parse(xmlhttp.responseText)
                    if (data.url && data.url.indexOf("http") != -1) {
                        qrcode.src = "data:image/png;base64," + data.img
                        loginUrl = data.url
                    } else {
                        showQrcode()
                    }

                }
            }
            xmlhttp.open("GET", "/api/login/qrcode", true);
            xmlhttp.send();
        }
        showQrcode()

        function login() {
            var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    var results = xmlhttp.responseText
                    console.log(results)
                    switch (results) {
                        case "授权登录未确认":
                            break;
                        case "登录":
                            setTimeout(() => {
                                window.location.href = "/admin"
                            }, 1000);
                        case "成功":
                            //hd.style.visibility = "hidden";
                            qrcode.src = success
                            clearInterval(timer)
                            break;
                        default:
                            showQrcode()
                            break;
                    }
                }
            }
            xmlhttp.open("GET", "/api/login/query", true);
            xmlhttp.send();
        }

        function polling() {
            timer = setInterval(() => {
                login()
            }, 1500);
        }
        polling()

        jumpapp.addEventListener('click', function() {
            if (loginUrl) {
                window.location.href = `openapp.jdmobile://virtual/ad?params=${encodeURI(
                JSON.stringify({
                    category: 'jump',
                    des: 'ThirdPartyLogin',
                    action: 'to',
                    onekeylogin: 'return',
                    url: loginUrl,
                    authlogin_returnurl: 'weixin://',
                    browserlogin_fromurl: window.location.host,
                })
            )}`;
            } else {
                alert('还没加载好，请稍后重试');
            }
        })
    </script>

</html>